<?php
class Arm_Form_Element_Cpf extends Zend_Form_Element
{
  public function init(){
    parent::init();

    $this ->addValidator(new Zend_Validate_Regex('/^\d{3}\.\d{3}\.\d{3}-\d{2}$/'));
    $this ->setOptions(array(
      'size'        => 15,
      'maxlength'   => 14,
      'onkeyup'     => 'formCpfMasc(this.id)',
      'onblur'      => 'validateCpf(this.id)',
    ));

    $this->addErrorMessage('CPF no formato inválido! Utilize, por exemplo, 999.999.999-99');
    $this ->addFilter('StripTags');
    $this ->addFilter('StringTrim');
  }
}
